home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / etc / dbus-1 / event.d / 20hal next >
Encoding:
Text File  |  2007-03-30  |  1.8 KB  |  86 lines

  1. #! /bin/sh
  2. #
  3. # hal        Start the Daemon that stores device informations
  4. #        for the Hardware abstraction layer
  5. #
  6. #        Written by Martin Waitz based on skeleton code
  7. #        written by Miquel van Smoorenburg <miquels@cistron.nl>.
  8. #        Modified for Debian 
  9. #        by Ian Murdock <imurdock@gnu.ai.mit.edu>.
  10. #
  11.  
  12. PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
  13. DAEMON=/usr/sbin/hald
  14. PIDDIR=/var/run/hal
  15. PIDFILE=$PIDDIR/hald.pid
  16. NAME=hald
  17. DAEMONUSER=haldaemon
  18. DESC="Hardware abstraction layer"
  19.  
  20. . /lib/lsb/init-functions
  21.  
  22. test -x $DAEMON || exit 0
  23.  
  24. # Include hal defaults if available
  25. if [ -f /etc/default/hal ] ; then
  26.     . /etc/default/hal
  27. fi
  28.  
  29. set -e
  30.  
  31. do_start() {
  32.   if [ ! -d $PIDDIR ]; then
  33.     mkdir -p $PIDDIR
  34.     chown $DAEMONUSER:$DAEMONUSER $PIDDIR
  35.   fi
  36.     log_daemon_msg "Starting $DESC" "$NAME"
  37.     start-stop-daemon --start --pidfile $PIDFILE \
  38.         --exec $DAEMON -- $DAEMON_OPTS
  39.     log_end_msg $?
  40. }
  41.  
  42. do_stop() {
  43.     log_daemon_msg "Stopping $DESC" "$NAME"
  44.     start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE \
  45.         --exec $DAEMON 
  46.     log_end_msg $?
  47. }
  48.  
  49. case "$1" in
  50.   start)
  51.     do_start
  52.     ;;
  53.   stop)
  54.     do_stop
  55.     ;;
  56.   #reload)
  57.     #
  58.     #    If the daemon can reload its config files on the fly
  59.     #    for example by sending it SIGHUP, do it here.
  60.     #
  61.     #    If the daemon responds to changes in its config file
  62.     #    directly anyway, make this a do-nothing entry.
  63.     #
  64.     # echo "Reloading $DESC configuration files."
  65.     # start-stop-daemon --stop --signal 1 --quiet --pidfile \
  66.     #    /var/run/$NAME.pid --exec $DAEMON
  67.   #;;
  68.   restart|force-reload)
  69.     #
  70.     #    If the "reload" option is implemented, move the "force-reload"
  71.     #    option to the "reload" entry above. If not, "force-reload" is
  72.     #    just the same as "restart".
  73.     #
  74.   do_stop
  75.     sleep 5
  76.   do_start
  77.     ;;
  78.   *)
  79.     # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
  80.     log_success_msg "Usage: $0 {start|stop|restart|force-reload}" >&2
  81.     exit 1
  82.     ;;
  83. esac
  84.  
  85. exit 0
  86.